﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace reseaux_neurones
{
    class Utilitaire
    {

        [STAThread]
        public static int Main(string[] args)
        {
            Run m = new Run();
            m.Apprentissage();

            return 0;
        }
        

        public static string[] ReadFileLearning(string _content)
        {
            string[] lines = _content.Split('\n');


            foreach (string line in lines)
            {

                if (Run.debug) System.Console.WriteLine(line);
            }

            return lines;
        }


        /* Open dialog Box and return the content in a string */
        public static string PickUpFileLearning()
        {

            OpenFileDialog Dialog = new OpenFileDialog();        
            Dialog.ShowDialog(); 
            
                System.IO.StreamReader sr = new
                System.IO.StreamReader(Dialog.FileName);
                String content = sr.ReadToEnd();
                sr.Close();

                if (Run.debug) System.Console.WriteLine("content of file: " + content);
                return content;


        }

        public static Reseaux[] Sort(Reseaux[] _tab)
        {

                for (int i = 0; i < _tab.Length-1; i++)
                {
                    for (int j = 0; j < _tab.Length-1; j++)
                    {
                        if (_tab[j + 1].getError() < _tab[j].getError())
                        {
                            Reseaux temp = _tab[j + 1];
                            _tab[j + 1] = _tab[j];
                            _tab[j] = temp;
                        }
                    }
                }
            

            return _tab;
        }

    }
}
